// v-text
Vue.directive('text', function (el, binding) {
    const { value } = binding
    el.textContent = value
})

// v-model
Vue.directive('model', function (el, binding) {
    const { value, expression } = binding
    el.value = value
    // 实现双向绑定
    el.addEventListener('input', () => {
        el.vm[expression] = el.value
    })
})

// v-html
Vue.directive('html', function (el, binding) {
    const { value } = binding
    el.innerHTML = value
})

// v-on
Vue.directive('on', function (el, binding) {
    const { value, argument } = binding

    el.addEventListener(argument, value)
})